package Java_Lab.Multithreading.ThreadPool;

import java.util.Random;

public class Worker implements Runnable {
	
	private Random rand = new Random();
	
	private int randInt(int min, int max){
		return rand.nextInt((max - min + 1)) + min;
	}
	
	private String name;
	
	public Worker(String name){
		this.name = name;
	}
	
	public void run() {
		System.out.println(name + " has been started");
		try{
			Thread.sleep(randInt(3000, 7000));
		} catch (InterruptedException e){
			e.printStackTrace();
		}
		System.out.println(name + " has been finished");
	}

}
